package com.xuecheng.manage_cms.controller;

import com.xuecheng.api.CmsSiteServceControllerApi;
import com.xuecheng.framework.domain.cms.CmsSiteServer;
import com.xuecheng.framework.domain.cms.request.QuerySiteServerRequest;
import com.xuecheng.framework.domain.cms.response.SiteServerResult;
import com.xuecheng.framework.model.response.QueryResponseResult;
import com.xuecheng.framework.model.response.ResponseResult;
import com.xuecheng.manage_cms.service.CmsSiteServerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/cms/site_server")
public class CmsSiteServerController implements CmsSiteServceControllerApi {

    //注入service
    @Autowired
    CmsSiteServerService cmsSiteServerService;

    @Override
    @GetMapping("/findList/{page}/{size}")
    public QueryResponseResult findList(@PathVariable("page") int page, @PathVariable("size") int size, QuerySiteServerRequest siteServerRequest) {
        return cmsSiteServerService.findList(page,size,siteServerRequest);
    }

    @Override
    @PostMapping("/add")
    public SiteServerResult add(@RequestBody CmsSiteServer cmsSiteServer) {
        return cmsSiteServerService.add(cmsSiteServer);
    }

    @Override
    @GetMapping("/findById/{id}")
    public CmsSiteServer findById(@PathVariable("id") String id) {
        return cmsSiteServerService.findById(id);
    }

    @Override
    @PutMapping("/edit/{id}")
    public SiteServerResult edit(@PathVariable("id") String id, @RequestBody CmsSiteServer cmsSiteServer) {
        return cmsSiteServerService.eidt(id,cmsSiteServer);
    }

    @Override
    @DeleteMapping("/delete/{id}")
    public ResponseResult delete(@PathVariable("id") String id) {
        return cmsSiteServerService.delete(id);
    }
}
